//
//  SYTabbarController.m

#import "SYTabbarController.h"

@interface SYTabbarController ()


@end

@implementation SYTabbarController

- (void)viewDidLoad {
    [super viewDidLoad];
    [UIViewController attemptRotationToDeviceOrientation];
    self.tabBar.hidden = YES;
    self.view.backgroundColor = [UIColor whiteColor];
}

//创建view 在viewcontrollers赋值之后
-(void)createDock{
    //加入侧边栏Dock
    self.dock = [[SYTabbarView alloc]initWithFrame:CGRectMake(0, 0, 60, [UIScreen mainScreen].bounds.size.height)];
    _dock.dockDelegate = self;
    //设置默认选中的界面  在设置代理之后调用之后
    [_dock selectItem];
    [self.view addSubview:_dock];
}

#pragma mark - SYTabbarView的代理
-(void)switchMainByTabItem:(SYTabbarView *)SYTabbarView originalTab:(NSInteger)start destinationTab:(NSInteger)end{
    self.selectedIndex = end - 10086;
}


#pragma mark - - orientation
// 是否支持转屏
- (BOOL)shouldAutorotate
{
    return [self.selectedViewController shouldAutorotate];
}
// 返回nav栈中的最后一个对象支持的旋转方向
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
    return [self.selectedViewController supportedInterfaceOrientations];
}
// 返回nav栈中最后一个对象,坚持旋转的方向
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return [self.selectedViewController preferredInterfaceOrientationForPresentation];
}

@end
